<?php
/**
 * Created by PhpStorm.
 * User: Janpoem
 * Date: 2016/1/31 0031
 * Time: 3:20
 */

namespace CSService\Controller;


use CSService\Model\User\User;
use Ke\Web\Controller;

class Abs extends Controller
{

	public $layout = 'default';

	/** @var User */
	public $user = null;

	public $notAuth = ['index#login', 'index#logout'];

	protected function onConstruct()
	{
		session_name(SESSION_NAME);
		session_start();
		if (isset($_SESSION['user_id']))
			$this->user = User::findOne($_SESSION['user_id']);
		else
			$this->user = new User();
		if ($this->user->isNew() && !$this->web->in(...$this->notAuth))
			$this->redirect('login');
	}

}